// src/utils/message.ts
import { ElMessage, ElMessageBox } from 'element-plus';

/**
 * 显示消息提示
 * @param message 消息内容
 * @param type 消息类型 (success/error/warning/info)
 */
export function showMessage(
    message: string,
    type: 'success' | 'error' | 'warning' | 'info' = 'info'
): void {
    ElMessage({
        message,
        type,
        duration: 3000,
        showClose: true
    });
}

/**
 * 显示确认对话框
 * @param content 内容
 * @param title 标题
 */
export function showConfirm(
    content: string,
    title: string = '提示'
): Promise<boolean> {
    return ElMessageBox.confirm(content, title, {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    })
        .then(() => true)
        .catch(() => false);
}